const { clipboard, nativeImage} = require("electron");

window.addEventListener("DOMContentLoaded", () => {
  copyBtn.addEventListener("click", () => {
    clipboard.writeText(copyText.value);
  });
  pasteBtn.addEventListener("click", () => {
    const copyValue = clipboard.readText(copyText.value);
    pasteText.value = copyValue;
  });

  clipImg.addEventListener("click", () => {
    const ioImg = nativeImage.createFromPath("./12-剪切板/img105.jpg");
    clipboard.writeImage(ioImg);

    // 将剪切板中的图片作为dom显示到界面
    const img = new Image();
    img.src = clipboard.readImage().toDataURL();
    document.body.appendChild(img);
  });
});